<ui:composition template="/WEB-INF/templates/templateMin.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
    <ui:define name="title">#{txt['login.title']}</ui:define>

    <ui:define name="content">
        <f:view locale="#{language.currentLocale}">
            <p:panel header="#{txt['login.title']}">
                <h:form id="login" prependId="false" onsubmit="document.getElementById('login').action='j_security_check';">
                   <p:panelGrid>
                        <p:row>
                            <p:column>
                                <h:outputLabel value="#{txt['login.label.nickname']}" />
                            </p:column>
                            <p:column>
                                <p:inputText id="j_username" required="true" label="#{txt['login.txtbx.nickname']}" />
                            </p:column>
                        </p:row>
                        <p:column rowspan="3">

                        </p:column>
                        <p:row>
                            <p:column>
                                <h:outputLabel value="#{txt['login.label.password']}" />
                            </p:column>
                            <p:column>
                                <p:password id="j_password" required="true" label="#{txt['login.txtbx.password']}" />
                            </p:column>
                        </p:row>
                        <p:row>
                            <p:column colspan="2" styleClass="footer">
                                <p:commandButton id="btn_register" value="#{txt['login.button.register']}" oncomplete="registerDlg.show()"
                                                 ajax="true" process="@this,btn_register"/>
                                <p:commandButton id="btn_login" value="#{txt['login.button.login']}" ajax="false" update=":growlForm" process="@form"/>
                            </p:column>
                        </p:row>
                    </p:panelGrid>
                </h:form>
                <p:spacer/>
                <h:form>
                    <p:panelGrid columns="2">
                        <h:outputLabel value="#{txt['global.language']}"/>
                        <h:selectOneMenu value="#{language.selectedCountry}" onchange="submit();"
                                valueChangeListener="#{language.countryLocaleCodeChanged}">
                            <f:selectItems value="#{language.countries}" />
                        </h:selectOneMenu>
                    </p:panelGrid>
                </h:form>
            </p:panel>
        </f:view>
    </ui:define>

   <ui:define name="appendBody">
        <f:view locale="#{language.currentLocale}">
            <h:form id="register">
                <p:dialog widgetVar="registerDlg" resizable="false" modal="true" hideEffect="fade" header="#{txt['register.title']}">
                    <p:panel>
                        <p:panelGrid id="register_grid" columns="2">
                            <h:outputLabel value="#{txt['register.label.nickname']}" />
                            <p:inputText id="nickname" value="#{registerBean.nickname}" required="true"
                                         label="#{txt['register.txtbx.nickname']}" />

                            <h:outputLabel value="#{txt['register.label.email']}" />
                            <p:inputText id="email" value="#{registerBean.email}" />

                            <h:outputLabel value="#{txt['register.label.password']}" />
                            <p:password id="password1" value="#{registerBean.pwd1}" feedback="true" required="true"
                                        label="#{txt['register.txtbx.password.passwort1']}" match="password2"
                                        promptLabel="#{txt['register.txtbx.password.prompt']}"
                                        weakLabel="#{txt['register.txtbx.password.weak']}"
                                        goodLabel="#{txt['register.txtbx.password.good']}"
                                        strongLabel="#{txt['register.txtbx.password.strong']}"/>

                            <h:outputLabel value="#{txt['register.label.passwordRpt']}" />
                            <p:password id="password2" value="#{registerBean.pwd2}" required="true"
                                        label="#{txt['register.txtbx.password.passwort2']}" />

                        </p:panelGrid>

                    </p:panel>
                    <f:facet name="footer">
                        <p:commandButton type="Button" value="#{txt['global.button.submit']}" process="@form"
                                         action="#{registerBean.newMember}" ajax="true" update="register_grid :growlForm"/>
                    </f:facet>
                </p:dialog>
            </h:form>
        </f:view>
    </ui:define>
</ui:composition>